<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

function  Star(name,age) {
    this.name=name
    this.age=age



  
}

//构造函数的prototype
Star.prototype.sayHi=function () {
     console.log('你好  es5 ')
}

Star.prototype.getFood=function () {
     console.log(' 吃饭')
}



let  ldh=new  Star('刘德华',19)
let  zxy= new Star('张学友',20)
let  gfc=  new  Star('郭富城',55)
//  ldh.sayHi()
//  zxy.sayHi()
//  gfc.sayHi()



console.log(ldh.__proto__===Star.prototype)
console.log(ldh.__proto__.constructor===Star)


console.log(zxy.__proto__.sayHi===Star.prototype.sayHi)
console.log(zxy.__proto__===ldh.__proto__)


    </script>
</body>
</html>